In [19]:
# Densities for flour types in grams/cup according to different sources
# USDA and Gold Medal from http://www.weekendbakery.com/cooking-conversions/
# King Arthur from http://www.kingarthurflour.com/recipe/master-weight-chart.html
# (rounded to nearest gram)
whole_wheat = {
"USDA": 125,
"Gold Medal": 128,
"King Arthur": 113,
}
all_purpose = {
"USDA": 125,
"Gold Medal": 130,
"King Arthur": 120
}
bread_flour = {
"USDA": 127,
"Gold Medal": 135,
"King Arthur": 120
}
rye = {
"USDA": 102,
# couldn't find Gold Medal's reported density for rye flour (do they make it?)
"King Arthur Medium Rye": 103,
"King Arthur White Rye": 106
}
In [4]:
import numpy
In [24]:
values = lambda flour: [grams for key, grams in flour.iteritems() if key not in ["average", "std"]]
In [25]:
# Compute average density
whole_wheat["average"] = numpy.mean(values(whole_wheat))
all_purpose["average"] = numpy.mean(values(all_purpose))
bread_flour["average"] = numpy.mean(values(bread_flour))
rye["average"] = numpy.mean(values(rye))
In [26]:
# Compute standard deviations
whole_wheat["std"] = numpy.std(values(whole_wheat))
all_purpose["std"] = numpy.std(values(all_purpose))
bread_flour["std"] = numpy.std(values(bread_flour))
rye["std"] = numpy.std(values(rye))
In [27]:
whole_wheat
Out[27]:
In [28]:
all_purpose
Out[28]:
In [29]:
bread_flour
Out[29]:
In [30]:
rye
Out[30]:
In [2]:
# A nice simple percentage function
percentage = lambda part, whole: (part * whole) / 100.0
In [4]:
# Eggs!
large_egg = 54.4 # USDA large egg (this is American)
shell = percentage(13, large_egg) #
Out[4]:
In [ ]: